.class public Lcom/kwad/sdk/widget/AnimatedImageView;
.super Lcom/kwad/sdk/core/page/widget/b;


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/kwad/sdk/widget/AnimatedImageView$a;
    }
.end annotation


# instance fields
.field private a:I

.field private b:I

.field private c:Landroid/support/rastermill/a;

.field private d:Landroid/support/rastermill/a;

.field private e:Lcom/kwad/sdk/widget/AnimatedImageView$a;

.field private f:Landroid/support/rastermill/a$e;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 0

    invoke-direct {p0, p1}, Lcom/kwad/sdk/core/page/widget/b;-><init>(Landroid/content/Context;)V

    const/4 p1, 0x1

    iput p1, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->a:I

    const/4 p1, 0x3

    iput p1, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->b:I

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 1

    invoke-direct {p0, p1, p2}, Lcom/kwad/sdk/core/page/widget/b;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    const/4 v0, 0x1

    iput v0, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->a:I

    const/4 v0, 0x3

    iput v0, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->b:I

    invoke-direct {p0, p1, p2}, Lcom/kwad/sdk/widget/AnimatedImageView;->a(Landroid/content/Context;Landroid/util/AttributeSet;)V

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .locals 0

    invoke-direct {p0, p1, p2, p3}, Lcom/kwad/sdk/core/page/widget/b;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    const/4 p3, 0x1

    iput p3, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->a:I

    const/4 p3, 0x3

    iput p3, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->b:I

    invoke-direct {p0, p1, p2}, Lcom/kwad/sdk/widget/AnimatedImageView;->a(Landroid/content/Context;Landroid/util/AttributeSet;)V

    return-void
.end method

.method static synthetic a(Lcom/kwad/sdk/widget/AnimatedImageView;)Lcom/kwad/sdk/widget/AnimatedImageView$a;
    .locals 0

    iget-object p0, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->e:Lcom/kwad/sdk/widget/AnimatedImageView$a;

    return-object p0
.end method

.method private a(Landroid/content/Context;Landroid/net/Uri;)Ljava/io/InputStream;
    .locals 2

    invoke-virtual {p2}, Landroid/net/Uri;->getScheme()Ljava/lang/String;

    move-result-object v0

    const-string v1, "file"

    invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    new-instance p1, Ljava/io/FileInputStream;

    new-instance v0, Ljava/io/File;

    invoke-virtual {p2}, Landroid/net/Uri;->getPath()Ljava/lang/String;

    move-result-object p2

    invoke-direct {v0, p2}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-direct {p1, v0}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V

    return-object p1

    :cond_0
    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object p1

    invoke-virtual {p1}, Landroid/content/res/Resources;->getAssets()Landroid/content/res/AssetManager;

    move-result-object p1

    invoke-virtual {p2}, Landroid/net/Uri;->getPath()Ljava/lang/String;

    move-result-object p2

    invoke-virtual {p1, p2}, Landroid/content/res/AssetManager;->open(Ljava/lang/String;)Ljava/io/InputStream;

    move-result-object p1

    return-object p1
.end method

.method private a(Landroid/content/res/Resources;I)Ljava/io/InputStream;
    .locals 0

    invoke-virtual {p1, p2}, Landroid/content/res/Resources;->openRawResource(I)Ljava/io/InputStream;

    move-result-object p1

    return-object p1
.end method

.method private a(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 0

    new-instance p1, Lcom/kwad/sdk/widget/AnimatedImageView$1;

    invoke-direct {p1, p0}, Lcom/kwad/sdk/widget/AnimatedImageView$1;-><init>(Lcom/kwad/sdk/widget/AnimatedImageView;)V

    iput-object p1, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->f:Landroid/support/rastermill/a$e;

    return-void
.end method

.method private a(Landroid/widget/ImageView;Landroid/net/Uri;)Z
    .locals 1

    if-eqz p2, :cond_1

    :try_start_0
    invoke-virtual {p1}, Landroid/widget/ImageView;->getContext()Landroid/content/Context;

    move-result-object v0

    invoke-direct {p0, v0, p2}, Lcom/kwad/sdk/widget/AnimatedImageView;->a(Landroid/content/Context;Landroid/net/Uri;)Ljava/io/InputStream;

    move-result-object p2

    new-instance v0, Landroid/support/rastermill/a;

    invoke-direct {v0, p2}, Landroid/support/rastermill/a;-><init>(Ljava/io/InputStream;)V

    iget p2, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->a:I

    invoke-virtual {v0, p2}, Landroid/support/rastermill/a;->a(I)V

    iget-object p2, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->f:Landroid/support/rastermill/a$e;

    invoke-virtual {v0, p2}, Landroid/support/rastermill/a;->a(Landroid/support/rastermill/a$e;)V

    invoke-virtual {p1, v0}, Landroid/widget/ImageView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V

    iget-object p1, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->c:Landroid/support/rastermill/a;

    if-eqz p1, :cond_0

    iget-object p1, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->c:Landroid/support/rastermill/a;

    invoke-virtual {p1}, Landroid/support/rastermill/a;->b()V

    :cond_0
    iput-object v0, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->c:Landroid/support/rastermill/a;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    const/4 p1, 0x1

    return p1

    :catch_0
    :cond_1
    const/4 p1, 0x0

    return p1
.end method

.method private a(ZI)Z
    .locals 1

    invoke-virtual {p0}, Landroid/widget/ImageView;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    if-eqz v0, :cond_4

    :try_start_0
    invoke-direct {p0, v0, p2}, Lcom/kwad/sdk/widget/AnimatedImageView;->a(Landroid/content/res/Resources;I)Ljava/io/InputStream;

    move-result-object p2

    new-instance v0, Landroid/support/rastermill/a;

    invoke-direct {v0, p2}, Landroid/support/rastermill/a;-><init>(Ljava/io/InputStream;)V

    iget p2, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->a:I

    invoke-virtual {v0, p2}, Landroid/support/rastermill/a;->a(I)V

    iget-object p2, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->f:Landroid/support/rastermill/a$e;

    invoke-virtual {v0, p2}, Landroid/support/rastermill/a;->a(Landroid/support/rastermill/a$e;)V

    if-eqz p1, :cond_1

    invoke-virtual {p0, v0}, Landroid/widget/ImageView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V

    iget-object p1, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->c:Landroid/support/rastermill/a;

    if-eqz p1, :cond_0

    iget-object p1, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->c:Landroid/support/rastermill/a;

    invoke-virtual {p1}, Landroid/support/rastermill/a;->b()V

    :cond_0
    iput-object v0, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->c:Landroid/support/rastermill/a;

    goto :goto_1

    :cond_1
    sget p1, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 p2, 0x10

    if-lt p1, p2, :cond_3

    invoke-virtual {p0, v0}, Landroid/widget/ImageView;->setBackground(Landroid/graphics/drawable/Drawable;)V

    iget-object p1, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->d:Landroid/support/rastermill/a;

    if-eqz p1, :cond_2

    iget-object p1, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->d:Landroid/support/rastermill/a;

    invoke-virtual {p1}, Landroid/support/rastermill/a;->b()V

    :cond_2
    :goto_0
    iput-object v0, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->d:Landroid/support/rastermill/a;

    goto :goto_1

    :cond_3
    invoke-virtual {p0, v0}, Landroid/widget/ImageView;->setBackgroundDrawable(Landroid/graphics/drawable/Drawable;)V

    iget-object p1, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->d:Landroid/support/rastermill/a;

    if-eqz p1, :cond_2

    iget-object p1, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->d:Landroid/support/rastermill/a;

    invoke-virtual {p1}, Landroid/support/rastermill/a;->b()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :goto_1
    const/4 p1, 0x1

    return p1

    :catch_0
    move-exception p1

    invoke-virtual {p1}, Ljava/lang/Exception;->printStackTrace()V

    :cond_4
    const/4 p1, 0x0

    return p1
.end method


# virtual methods
.method public a()V
    .locals 1

    const/4 v0, 0x1

    iput v0, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->b:I

    return-void
.end method

.method public b()V
    .locals 1

    iget-object v0, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->c:Landroid/support/rastermill/a;

    if-eqz v0, :cond_0

    invoke-virtual {v0}, Landroid/support/rastermill/a;->start()V

    :cond_0
    return-void
.end method

.method public c()V
    .locals 1

    iget-object v0, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->c:Landroid/support/rastermill/a;

    if-eqz v0, :cond_0

    invoke-virtual {v0}, Landroid/support/rastermill/a;->stop()V

    :cond_0
    return-void
.end method

.method public setBackgroundResource(I)V
    .locals 1

    const/4 v0, 0x0

    invoke-direct {p0, v0, p1}, Lcom/kwad/sdk/widget/AnimatedImageView;->a(ZI)Z

    move-result v0

    if-nez v0, :cond_0

    invoke-super {p0, p1}, Landroid/widget/ImageView;->setBackgroundResource(I)V

    :cond_0
    return-void
.end method

.method public setImageResource(I)V
    .locals 1

    const/4 v0, 0x1

    invoke-direct {p0, v0, p1}, Lcom/kwad/sdk/widget/AnimatedImageView;->a(ZI)Z

    move-result v0

    if-nez v0, :cond_0

    invoke-super {p0, p1}, Landroid/widget/ImageView;->setImageResource(I)V

    :cond_0
    return-void
.end method

.method public setImageURI(Landroid/net/Uri;)V
    .locals 1

    invoke-direct {p0, p0, p1}, Lcom/kwad/sdk/widget/AnimatedImageView;->a(Landroid/widget/ImageView;Landroid/net/Uri;)Z

    move-result v0

    if-nez v0, :cond_0

    invoke-super {p0, p1}, Landroid/widget/ImageView;->setImageURI(Landroid/net/Uri;)V

    :cond_0
    return-void
.end method

.method public setLoopCount(I)V
    .locals 1

    iput p1, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->a:I

    invoke-virtual {p0}, Lcom/kwad/sdk/widget/AnimatedImageView;->a()V

    iget-object p1, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->d:Landroid/support/rastermill/a;

    if-eqz p1, :cond_0

    iget v0, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->a:I

    invoke-virtual {p1, v0}, Landroid/support/rastermill/a;->a(I)V

    :cond_0
    iget-object p1, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->c:Landroid/support/rastermill/a;

    if-eqz p1, :cond_1

    iget v0, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->a:I

    invoke-virtual {p1, v0}, Landroid/support/rastermill/a;->a(I)V

    :cond_1
    return-void
.end method

.method public setOnFinishedListener(Lcom/kwad/sdk/widget/AnimatedImageView$a;)V
    .locals 0

    iput-object p1, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->e:Lcom/kwad/sdk/widget/AnimatedImageView$a;

    return-void
.end method

.method public setWebpStream(Landroid/support/rastermill/FrameSequence;)V
    .locals 1

    if-nez p1, :cond_0

    return-void

    :cond_0
    :try_start_0
    new-instance v0, Landroid/support/rastermill/a;

    invoke-direct {v0, p1}, Landroid/support/rastermill/a;-><init>(Landroid/support/rastermill/FrameSequence;)V

    iget p1, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->a:I

    invoke-virtual {v0, p1}, Landroid/support/rastermill/a;->a(I)V

    iget-object p1, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->f:Landroid/support/rastermill/a$e;

    invoke-virtual {v0, p1}, Landroid/support/rastermill/a;->a(Landroid/support/rastermill/a$e;)V

    invoke-virtual {p0, v0}, Landroid/widget/ImageView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V

    iget-object p1, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->c:Landroid/support/rastermill/a;

    if-eqz p1, :cond_1

    iget-object p1, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->c:Landroid/support/rastermill/a;

    invoke-virtual {p1}, Landroid/support/rastermill/a;->b()V

    :cond_1
    iput-object v0, p0, Lcom/kwad/sdk/widget/AnimatedImageView;->c:Landroid/support/rastermill/a;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    move-exception p1

    invoke-virtual {p1}, Ljava/lang/Exception;->printStackTrace()V

    :goto_0
    return-void
.end method
